<?php

namespace app\model;

use app\BaseModel;
use think\model\relation\HasMany;

/**
 * 量表问题表
 */
class RatingScaleQuestionModel extends BaseModel
{
    protected $name = 'rating_scale_question';

    /**
     * 新增数据验证
     * @return array
     */
    public function addValidate()
    {
        return [
            'rating_scale_id|量表id'  => 'require',
            'name|题目'  => 'require',
            'type|类型'  => 'require',
            'num|题号'  => 'require',
        ];
    }

    /**
     * 关联答案
     * @return HasMany
     */
    public function RatingScaleQuestionAnswer(): HasMany
    {
        return $this->hasMany('RatingScaleQuestionAnswerModel', 'question_id');
    }
}